package com.ntv.presentation.spring.web.astrology;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author Vedamoorthi Vairam
 *
 */
@Controller
public class AstrologyHomeController {
	
	private static final Logger logger = Logger
					.getLogger(AstrologyHomeController.class);
	
	@RequestMapping("/astrologyhome.html")
	public ModelAndView getAstrology() throws Exception 
	{
		System.out.println(" ************ CALLED  : " + " **********************");

		Map model = new HashMap();
		ModelAndView mav = new ModelAndView("home.astrology", model );
		return mav;
	}

	@RequestMapping("/astrologydetails.html")
	public ModelAndView getAstrology(@RequestParam("id") Long zodiacZoneId) throws Exception 
	{
		System.out.println(" ************ CALLED  : "+ zodiacZoneId + " **********************");

		Map model = new HashMap();
		ModelAndView mav = new ModelAndView("astrology.details", model );
		return mav;
	}

	
	@InitBinder
	public void initBinder(WebDataBinder binder) {
		logger.info(" initBinder of astrology home controller ");
		binder.setAllowedFields(new String[] { "id", "zodiacZoneId", "date", "description" });
		
	}
}